 package pl.edu.agh.thieves.firefly;

import pl.edu.agh.thieves.common.Item;

public class Enviroment {

	public double countValueByCoordinates(Coordinates coordinates) {
		double weight = 0;
		double price = 0;
		for (int i = 0; weight < thiefCapacity && i < coordinates.getDimension(); ++i) {
			int existance = (int) Math.floor(coordinates.getCoordinateByNumber(i));
			weight += items[i].getWeight() * existance;
			price += items[i].getValue() * existance;
		}

		if (weight > thiefCapacity)
			return 0;
		return price;
	}

	public double getAlpha() {
		return alpha;
	}

	public double getBeta() {
		return beta;
	}

	public double getGamma() {
		return gamma;
	}

	public int getItemNumber() {
		return items.length;
	}
	
	public Item getItem(int number){
		return items[number];
	}

	public Enviroment(Item[] items, double thiefCapacity, double alpha, double beta, double gamma) {
		this.items = items;
		this.thiefCapacity = thiefCapacity;
		this.alpha = alpha;
		this.beta = beta;
		this.gamma = gamma;
	}

	private Item[] items = null;
	private double thiefCapacity = 0;
	private double alpha = 0;
	private double beta = 0;
	private double gamma = 0;

}

